package com.evan.wj.service;

import com.evan.wj.dao.CareerDAO;
import com.evan.wj.pojo.Career;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class CareerService {
    @Autowired
    CareerDAO careerDAO;

    public List<Career> list() {
        Sort sort = new Sort(Sort.Direction.DESC, "id");
        return careerDAO.findAll(sort);
    }

    public Career get(int id) {
        Career c= careerDAO.findById(id).orElse(null);
        return c;
    }
}


